<?php


  function service_registration_form_validation($form) {


	// District
	distvalidation($form['field_src_dist']['und']['#value']);

    // maximum length validation for Title and Description Field
    maxlength_validation($form['title']['#value'], 255, $form['title']['#title'], 'title');

	// minimum length charcter
  	minilength_validation($form['title']['#value'], 5, $form['title']['#title'], 'title');
  	minilength_validation($form['field_src_keyword']['und'][0]['value']['#value'], 5, $form['field_src_keyword']['und'][0]['value']['#title'],'field_src_keyword');
	minilength_validation($form['field_scr_desc']['und'][0]['value']['#value'], 5, $form['field_scr_desc']['und'][0]['value']['#title'],'field_scr_desc');

    // Check bad character validation for Title and Description field
    chkbadchar($form['title']['#value'], $form['title']['#title'], 'title');
    chkbadchar($form['field_scr_desc']['und'][0]['value']['#value'], $form['field_scr_desc']['und'][0]['value']['#title'], 'field_scr_desc');
	chkbadchar($form['field_src_keyword']['und'][0]['value']['#value'], $form['field_src_keyword']['und'][0]['value']['#title'], 'field_src_keyword');
	chkbadchar($form['field_web_othercategory']['und'][0]['value']['#value'], $form['field_web_othercategory']['und'][0]['value']['#title'], 'field_web_othercategory');
	// Date Validation

   //check_scheduler_date_expire($form['scheduler_settings']['unpublish_on']['date']['#value'],'unpublish_on');

  // Form Type validtion
	if ($form['field_src_type']['und']['#value'] == 'online') {
	  url_validation($form['field_src_website']['und'][0]['value']['#value']);
	}

	if ($form['field_src_type']['und']['#value'] == 'download') {
	$filename = $form['field_src_upload']['und'][0]['#file'];
	$filename->filename;
    file_upload_validation_D7($filename->filename,$form['field_src_type']['und']['#title']);

  }


  } //function service_registration_form_validation()



  function service_presave_validation($node) {  //print '<pre>'; print_r($node); print '</pre>';exit;
    $reference_url = $node->field_src_website['und'][0]['value'];
    $node->field_src_website['und'][0]['value'] = url_validation($reference_url);
  } // function service_presave_validation()



